home *** CD-ROM | disk | FTP | other *** search
Makefile | 1998-12-03 | 12.7 KB | 322 lines | [TEXT/MPS ] |
- #
- # FatMakefile
- #
- # Example MPW makefile for building 68K, PowerPC, and Fat versions of
- # applications.
- #
- # Authors: Richard Clark
- # Jordan Mattson
- # Eric Traut
- #
- # © Copyright 1993, Apple Computer, Inc
- # All rights reserved
- #
- # History:
- #
- # 09/29/93, JM — First public release
- # 10/21/93, JM — Updated to work with the Macintosh on RISC SDK, Alpha Release
- #
- #
- # Command Line Examples:
- #
- # Make -f FatMakefile all
- # Make -f FatMakefile MyApp.noopt.PPC
- # Make -f FatMakefile MyApp.opt.PPC
- # Make -f FatMakefile MyApp.noopt.68K
- # Make -f FatMakefile MyApp.opt.68K
- # Make -f FatMakefile MyApp.noopt.fat
- # Make -f FatMakefile MyApp.opt.fat
- #
- # Description:
- #
- # This makefile builds non-optimized 680x0, optimized, 680x0, non-optimized PowerPC,
- # optimized PowerPC, non-optimized fat binary, and optimized fat binary versions of
- # an application.
- #
- # This makefile assumes that folders and files associated with the project
- # MyProject is included in a folder with the path {Boot}MyProjects:MyProject.
- # Included in this folder are the following:
- #
- # FatMakefile — This makefile adapted to your project
- #
- # IncludesF — A folder containing your application’s include
- # files.
- #
- # SourcesF — A folder containing your application’s source files.
- #
- # ResourcesF — A folder containing your application’s rez files.
- #
- # PPCObjectsNoOptF — A folder containing your application’s non-optimized
- # PowerPC object files.
- #
- # PPCObjectsOptF — A folder containing your application’s optimized
- # PowerPC object files.
- #
- # 68KObjectsNoOptF — A folder containing your application’s non-optimized
- # 68K object files.
- #
- # 68KObjectsOptF — A folder containing your application’s optimized
- # 68K object files.
- #
- #
- # You need to search for and modify the following variable definitions:
- #
- # AppName — Change from "MyApp" to the actual name of your application.
- #
- # Creator — Change from 'XXXX' to the correct creator for your application
- #
- # RootPath — "MyProjects" and "MyProject" to the actual name of your projects
- # folder and the folder for this particular project.
- #
- # AppRscs — Change from "MyApp.r" to the actual name of the Rez file containing
- # your resources.
- #
- # PPCAppRscs — Change from "MyPPCApp.r" to the actual name of the Rez file containing
- # your PowerPC specific resources.
- #
- # MergeCodeRscsNoOpt — No need to change the variable definition, but you do need
- # to create a file with this name to create your non-optimized fat
- # binary.
- #
- # MergeCodeRscsOpt — No need to change the variable definition, but you do need to create
- # a file with this name to create your optimized fat binary.
- #
-
- # Define the name of the application.
- AppName = MyApp
-
- # Define the creator and type for our application.
- Creator = 'XXXX'
- Type = 'APPL'
-
- # Define the path to our root for this project.
- RootPath = "{Boot}"MyProjects:MyProject:
-
- # Define the names of the folders that contain the include, source, and resource files.
- IncludesF = "{RootPath}"Includes:
- SourcesF = "{RootPath}"Sources:
- ResourcesF = "{RootPath}"Resources:
-
- # Define the names of the folder that contain the PPC optimized and non-optimized object
- # and the 68K optimized and non-optimized files.
- PPCObjectsNoOptF = "{RootPath}"ObjectsNoOptPPC:
- PPCObjectsOptF = "{RootPath}"ObjectsOptPPC:
- 68KObjectsNoOptF = "{RootPath}"ObjectsNoOpt68K:
- 68KObjectsOptF = "{RootPath}"ObjectsOpt68K:
-
- # Symbolics are off when we are not doing a debug build, but on when we are doing a symbolic build.
- Symbolics = on
-
- # Setup the definitions for PPCC no optimizations and optimizations. For this program we are choosing
- # to optimize for speed. You can optimize for speed or size and choose you level of optimization.
- # Note that do to the cache architecture of the PowerPC, optimizing for size can sometimes lead
- # to a faster executable, and optimizing for speed can sometimes lead to a slower executable. The
- # only way to tell is by trying it out with your program.
- PPCNoOptimizations = off
- PPCOptimizations = speed
-
- # Setup the definitions for the 68K no optimizations and optimziations.
- 68KNoOptimizations = off
- 68KOptimizations = on
-
- # Define the various resource files.
- AppRscs = MyApp.r
- PPCAppRscs = MyPPCApp.r
- MergeCodeRscsNoOpt = MergeCode.NoOpt.r
- MergeCodeRscsOpt = MergeCode.Opt.r
-
- # Define the libraries we must link with for the PowerPC. You may or may not need some of these
- # files, but we have defined them all.
- StandardLibsPPC = "{PPCLibraries}"InterfaceLib.xcoff ∂
- "{PPCLibraries}"MathLib.xcoff ∂
- "{PPCLibraries}"PPCCRuntime.o ∂
- "{PPCLibraries}"StdCLib.xcoff ∂
- "{PPCLibraries}"StdCRuntime.o
-
- # Define the library equates for the PowerPC.
- LIBEQUATES = -l InterfaceLib.xcoff=InterfaceLib∂
- -l StdCLib.xcoff=StdCLib∂
- -l MathLib.xcoff=MathLib
-
-
- # Define the libraries we must link with for the 68K. You may or may not need some of these.
- StandardLibs68K = "{CLibraries}"CSANELib.o ∂
- "{CLibraries}"Math.o ∂
- "{CLibraries}"StdClib.o ∂
- "{Libraries}"Runtime.o ∂
- "{Libraries}"Interface.o
-
- # Define the various collections of object files.
-
- # Define the non-optimized PowerPC object files. You will need to fill in all of the correct
- # file names using the format "ObjectFile.c.o.noopt.PPC".
- PPCObjectsNoOpt = "{PPCObjectsNoOptF}"MyObjectFile1.c.o.noopt.PPC ∂
- "{PPCObjectsNoOptF}"MyObjectFile2.c.o.noopt.PPC
-
- # Define the optimized PowerPC object files. You will need to fill in all of the correct
- # file names using the format "ObjectFile.c.o.opt.PPC"
- PPCObjectsOpt = "{PPCObjectsOptF}"MyObjectFile1.c.o.opt.PPC ∂
- "{PPCObjectsOptF}"MyObjectFile2.c.o.opt.PPC
-
- # Define the no optimized 68K object files. You will need to fill in all of the correct
- # file names using the format "ObjectFile.c.o.noopt.68K".
- 68KObjectsNoOpt = "{68KObjectsNoOptF}"MyObjectFile1.c.o.noopt.68K ∂
- "{68KObjectsNoOptF}"MyObjectFile2.c.o.noopt.68K
-
- # Define the optimized 68K object files. You will need to fill in all of the correct
- # file names using the format "ObjectFile.c.o.opt.68K".
- 68KObjectsOpt = "{68KObjectsOptF}"MyObjectFile1.c.o.opt.68K ∂
- "{68KObjectsOptF}"MyObjectFile2.c.o.opt.68K
-
- # Make the objects folders (Non-optimized PowerPC, optimized PowerPC, non-optimized 68K, and
- # optimized 68K) dependent on the sources folder.
- {PPCObjectsNoOptF} ƒ {SourcesF}
- {PPCObjectsOptF} ƒ {SourcesF}
- {68KObjectsNoOptF} ƒ {SourcesF}
- {68KObjectsOptF} ƒ {SourcesF}
-
- # Make .c.o.noopt.PPC (non-optimized PowerPC C object files) files dependent on .c files.
- .c.o.noopt.PPC ƒ .c
- Echo "{default}.c — Starting to compile at "`Date`"."
- PPCC -opt {PPCNoOptimizations} -i {IncludesF} -appleext on -w {SourcesF}{default}.c -o {PPCObjectsNoOptF}{default}.c.o.noopt.PPC
- Echo "{default}.c — Through compiling at"`Date`"."
- Echo " "
-
- # Make .c.o.opt.PPC (optimized PowerPC C object files) files dependent on .c files.
- .c.o.opt.PPC ƒ .c
- Echo "{default}.c — Starting to compile at "`Date`"."
- PPCC -opt {PPCOptimizations} -i {IncludesF} -appleext on -w {SourcesF}{default}.c -o {PPCObjectsOptF}{default}.c.o.opt.PPC
- Echo "{default}.c - Through compiling at"`Date`"."
- Echo " "
-
- # Make .c.o.noopt.68K (non-optimized 68K C object files) files dependent on .c files.
- .c.o.noopt.68K ƒ .c
- Echo "{default}.c — Starting to compile at "`Date`"."
- c -opt {68KNoOptimizations} -i {IncludesF} {SourcesF}{default}.c -o {68KObjectsNoOptF}{default}.c.o.noopt.68k
- Echo "{default}.c - Through compiling at"`Date`"."
- Echo " "
-
- # Make .c.o.opt.68K (optimized 68K C object files) files dependent on .c files.
- .c.o.opt.68K ƒ .c
- Echo "{default}.c — Starting to compile at "`Date`"."
- c -opt {68KOptimizations} -i {IncludesF} {SourcesF}{default}.c -o {68KObjectsOptF}{default}.c.o.opt.68k
- Echo "{default}.c - Through compiling at"`Date`"."
- Echo " "
-
-
- # Make the token all dependent on making the PowerPC non-optimized, PowerPC optimized, 68K
- # non-optimzied, 68K optimized, non-optimzed fat, and optimized fat versions of our
- # application.
- all ƒ {AppName}.noopt.PPC {AppName}.opt.PPC ∂
- {AppName}.noopt.68K {AppName}.opt.68K ∂
- {AppName}.noopt.fat {AppName}.opt.fat
-
- # ----- PowerPC version of the application, non-optimized.
- {AppName}.noopt.PPC ƒƒ {PPCObjectsNoOpt}
- # Link 'em together
- Echo "{TARG} — Starting to link at "`Date`"."
- PPCLink {PPCObjectsNoOpt} {StandardLibsPPC} -sym {Symbolics} -o {TARG}.xcoff ∑ linker_messages
- Echo "{TARG} — Through linking at "`Date`"."
-
- # Create pef executable
- Echo "{TARG} — Starting to MakePEF at "`Date`"."
- makepef {TARG}.xcoff -o {TARG} {LIBEQUATES}
- Echo "{TARG} — Through doing MakePEF at "`Date`"."
-
- # Set the type and creator of the target.
- Echo "{TARG} — Starting to set type and creator at "`Date`"."
- setfile -t {Type} -c {Creator} -a Bi {TARG}
- Echo "{TARG} — Through setting type and creator at "`Date`"."
-
- # Optional step for debugging
- if {Symbolics} =~ /on/
-
- Echo "{TARG} — Starting to MakeSym at "`Date`"."
- makesym -r -o {TARG}.SYM {TARG}.xcoff
- Echo "{TARG} — Through doing MakeSym at "`Date`"."
- end # If
-
- {AppName}.noopt.PPC ƒƒ {ResourcesF}{AppRscs} {ResourcesF}{PPCAppRscs}
- Echo "{TARG} — Starting to Rez at "`Date`"."
- rez {ResourcesF}{AppRscs} {ResourcesF}{PPCAppRscs} -a -o {TARG}
- Echo "{TARG} — Through doing Rez at "`Date`"."
-
- # ----- PowerPC version of the application, optimized.
- {AppName}.opt.PPC ƒƒ {PPCObjectsOpt}
- Echo "{TARG} — Starting to link at "`Date`"."
- PPCLink {PPCObjectsOpt} {StandardLibsPPC} -sym {Symbolics} -o {TARG}.xcoff ∑ linker_messages
- Echo "{TARG} — Through linking at "`Date`"."
-
- # Create the PEF executable
- Echo "{TARG} — Starting to MakePEF at "`Date`"."
- makepef {TARG}.xcoff -o {TARG} {LIBEQUATES}
- Echo "{TARG} — Through doing MakePEF at "`Date`"."
-
- # Set the type and creator for the executable.
- Echo "{TARG} — Starting to set type and creator at "`Date`"."
- setfile -t {Type} -c {Creator} -a Bi {TARG}
- Echo "{TARG} — Through setting type and creator at "`Date`"."
-
- {AppName}.opt.PPC ƒƒ {ResourcesF}{AppRscs} {ResourcesF}{PPCAppRscs}
- Echo "{TARG} — Starting to Rez at "`Date`"."
- rez {ResourcesF}{AppRscs} {ResourcesF}{PPCAppRscs} -a -o {TARG}
- Echo "{TARG} — Through doing Rez at "`Date`"."
-
- # ----- 680x0 version of the application, non-optimized.
- {AppName}.noopt.68K ƒƒ {68kObjectsNoOpt}
- # Link them together
- Echo "{TARG} — Starting to link at "`Date`"."
- Link {68kObjectsNoOpt} {StandardLibs68K} -o {TARG}
- Echo "{TARG} — Through linking at "`Date`"."
-
- # Set the type and creator of the target.
- Echo "{TARG} — Starting to set type and creator at "`Date`"."
- setfile -t {Type} -c {Creator} -a Bi {TARG}
- Echo "{TARG} — Through setting type and creator at "`Date`"."
-
- {AppName}.noopt.68K ƒƒ {ResourcesF}{AppRscs}
- Echo "{TARG} — Starting to Rez at "`Date`"."
- rez {ResourcesF}{AppRscs} -a -o {TARG}
- Echo "{TARG} — Through doing Rez at "`Date`"."
-
- # ----- 680x0 version of the application, optimized.
- {AppName}.opt.68K ƒƒ {68KObjectsOpt}
- # Link them together
- Echo "{TARG} — Starting to link at "`Date`"."
- Link {68KObjectsOpt} {StandardLibs68K} -o {TARG}
- Echo "{TARG} — Through linking at "`Date`"."
-
- # Set the type and creator of the target.
- Echo "{TARG} — Starting to set type and creator at "`Date`"."
- setfile -t {Type} -c {Creator} -a Bi {TARG}
- Echo "{TARG} — Through setting type and creator at "`Date`"."
-
- {AppName}.opt.68K ƒƒ {ResourcesF}{AppRscs}
- Echo "{TARG} — Starting to Rez at "`Date`"."
- rez {ResourcesF}{AppRscs} -a -o {TARG}
- Echo "{TARG} — Through doing Rez at "`Date`"."
-
- # ----- "Fat" Binary for 68K and PowerPC (68K and PowerPC version are non-optimized)
- {AppName}.noopt.fat ƒƒ {AppName}.noopt.PPC {AppName}.noopt.68K {ResourcesF}{MergeCodeRscsNoOpt}
- # Duplicate the PowerPC code into the fat binary package.
- Echo "{TARG} — Starting to duplicate for fat binary at "`Date`"."
- duplicate -y {AppName}.noopt.PPC {AppName}.noopt.fat
- Echo "{TARG} — Through duplicating for fat binary at "`Date`"."
-
- # rez in 'CODE' resources from 68K version (68K name is in the .r file)
- Echo "{TARG} — Starting to Rez for fat binary at "`Date`"."
- rez {ResourcesF}{MergeCodeRscsNoOpt} -a -o {AppName}.noopt.fat
- Echo "{TARG} — Through doing Rez at "`Date`"."
-
- # ----- "Fat" Binary for 68K and PowerPC (68K and PowerPC versions are optimized)
- {AppName}.opt.fat ƒƒ {AppName}.opt.PPC {AppName}.opt.68K {ResourcesF}{MergeCodeRscsOpt}
- # Duplicate the PowerPC code into the fat binary package.
- Echo "{TARG} — Starting to duplicate for fat binary at "`Date`"."
- duplicate -y {AppName}.opt.PPC {AppName}.opt.fat
- Echo "{TARG} — Through duplicating for fat binary at "`Date`"."
-
- # rez in 'CODE' resources from 68K version (68K name is in the .r file)
- Echo "{TARG} — Starting to Rez for fat binary at "`Date`"."
- rez {ResourcesF}{MergeCodeRscsOpt} -a -o {AppName}.opt.fat
- Echo "{TARG} — Through doing Rez at "`Date`"."
-